import $ from 'jquery'
import {
  message
} from 'antd';


(function () {
  let t = {};
  // t.baseUrl = 'http://192.168.30.28:8080/';

  // t.baseUrl = 'http://192.168.30.98:8087/';
  t.baseUrl = 'http://218.94.137.246:8087/'
  // t.baseUrl = 'http://192.168.30.17:8080/';
  // t.baseUrl = 'http://192.168.30.100:8080/';

  // t.weChatUrl = 'http://180.97.15.181:8899/';
  // t.weChatUrl = 'http://192.168.30.100:8080/';
  t.weChatUrl = 'http://218.94.137.246:8087/';
  // t.weChatUrl = 'http://192.168.30.100:8080/';
  // t.imgUrl = 'http://218.94.137.246:35996/images/d/a/'
  t.imgUrl = 'http://218.94.137.246:35996/'

  t.testurl = window.location.href.split("#")[0] + "#";
  // t.baseUrl = 'http://192.168.30.45:8080/'
  // t.baseUrl = 'http://192.168.30.17:8080/'

  t.url = {
    login: t.baseUrl + 'vrv-monitor-platform-web/login', //登录
    userInfo: t.baseUrl + 'vrv-monitor-platform-web/user/read/userInfo', //登录人信息
    logout: t.baseUrl + 'vrv-monitor-platform-web/logout', //登出
    queryList: t.baseUrl + 'vrv-monitor-platform-web/tibet/queryByUserKey', //查询舆情列表
    userList: t.baseUrl + 'vrv-monitor-platform-web/userKey/userKeyGroup', //查询舆情列表'
    userData: t.baseUrl + 'vrv-monitor-platform-web/tibet/queryByTimeOrWebSiteOrPnWithPageAndSize', //首页数据查询
    queryListyangpang: t.baseUrl + 'vrv-monitor-platform-web/tibet/queryByTimeOrWebSiteOrPnWithPageAndSize', //研判列表
    tibetModule: t.baseUrl + 'vrv-monitor-platform-web/tibetModule', //专题接口
    del: t.baseUrl + 'vrv-monitor-platform-web/tibet/deleteDocumentById', //删除
    yangpang: t.baseUrl + 'vrv-monitor-platform-web/tibet/modifyJudgeTypeById', //研判
    detail: t.baseUrl + 'vrv-monitor-platform-web/tibet/queryByTibetId', //详情
    create: t.baseUrl + 'vrv-monitor-platform-web/tibetHomePageModule', //创建主页
    keyWord: t.baseUrl + 'vrv-monitor-platform-web/userKey/userKeyGroup', //查询关键字
    read: t.baseUrl + 'vrv-monitor-platform-web/tibetHomePageModule', //获取主页模块信息
    delete: t.baseUrl + 'vrv-monitor-platform-web/tibetHomePageModule', //删除主页模块
    update: t.baseUrl + 'vrv-monitor-platform-web/tibetHomePageModule', //修改主页模块
    insertKey: t.baseUrl + 'vrv-monitor-platform-web/userKey/createKeyGroup', //插入用户关键词组
    queryKey: t.baseUrl + 'vrv-monitor-platform-web/userKey/userKeyGroup', //查询用户关键词组
    editKey: t.baseUrl + 'vrv-monitor-platform-web/userKey/modifyKeyGroup', //修改用户关键词组
    delKeygroup: t.baseUrl + 'vrv-monitor-platform-web/userKey/deleteKeyGroup', //删除用户关键词组
    addSamplelibrary: t.baseUrl + 'vrv-monitor-platform-web/tibetCollection/addUserCollection', //加入样本库
    deleteYb: t.baseUrl + 'vrv-monitor-platform-web/tibetCollection/deleteUserCollection', //删除样本库
    selectYb: t.baseUrl + 'vrv-monitor-platform-web/tibetCollection/getUserCollection', //查询样本库
    diTu: t.weChatUrl + 'WeChatCollect/position/addPosition', //地图位置
    getNum: t.weChatUrl + 'WeChatCollect/position/isOverMaxPosition', // 采集限制
    findPosition: t.weChatUrl + 'WeChatCollect/position/findAllPositionList', //历史记录
    morePostion: t.weChatUrl + 'WeChatCollect/roundList/findRoundList', //根据ID查到相应的朋友
    getCollection: t.baseUrl + 'vrv-monitor-platform-web/tibetCollectionRange/-1/1/500', //获取采集范围
    addCollection: t.baseUrl + 'vrv-monitor-platform-web/tibetCollectionRange', //添加采集范围
    delCollection: t.baseUrl + 'vrv-monitor-platform-web/tibetCollectionRange', //删除采集范围
    editCollection: t.baseUrl + 'vrv-monitor-platform-web/tibetCollectionRange', //修改采集范围
    getBlack: t.baseUrl + 'vrv-monitor-platform-web/tibetBlackList/-1/1/500', //查询黑名单
    addBlack: t.baseUrl + 'vrv-monitor-platform-web/tibetBlackList', //添加黑名单
    delBlack: t.baseUrl + 'vrv-monitor-platform-web/tibetBlackList', //删除黑名单
    editBlack: t.baseUrl + 'vrv-monitor-platform-web/tibetBlackList', //修改黑名单
    simplee: t.baseUrl + 'vrv-monitor-platform-web/tibetWarning/getUserWarningList', //预警查询
    friendquan: t.weChatUrl + 'WeChatCollect/round/findRoundContent', //朋友圈
    wxList: t.weChatUrl + 'WeChatCollect/group/searchGroupList', // 微信群基本信息列表
    wxListPeople: t.weChatUrl + 'WeChatCollect/member/findMemberList', //微信群成员
    wxListContent: t.weChatUrl + 'WeChatCollect/record/findRecordList', //微信群内容
    publickList: t.baseUrl + 'vrv-monitor-platform-web/offcialAccount', //公众号列表
    simple: t.baseUrl + 'vrv-monitor-platform-web/tibetWarning/getUserWarning', //预警查询
    addSimple: t.baseUrl + 'vrv-monitor-platform-web/tibetWarning/operateUserWarning', //新增修改预警信息
    dataStatistics: t.baseUrl + 'vrv-monitor-platform-web/tibet/queryByTimeOrWebSiteOrPnWithPageAndSize', //数据统计接口
    collection: t.weChatUrl + 'WeChatCollect/group/updateCollectStatus', //添加和取消群收藏
    alreadyCollected: t.weChatUrl + 'WeChatCollect/group/selectCollectedGroups', //查看已收藏的群列表
    friendCollection: t.weChatUrl + 'WeChatCollect/user/updateUserStatus', //添加和取消个人朋友圈账号收藏
    alreadyFriendCollection: t.weChatUrl + 'WeChatCollect/user/selectCollectUsers', //查看已收藏的个人朋友圈账号列表
    allCollection: t.weChatUrl + 'WeChatCollect/user/findUserList', //查看所有的个人朋友圈账号列表
    wxCollection: t.weChatUrl + 'WeChatCollect/round/findPersonalContent', //根据微信号查看个人朋友圈列表
    instragram: t.baseUrl + 'vrv-monitor-platform-web/tibetInstagram/queryAllAccountOfInsgram', //查询instragram列表
    instragramPage: t.baseUrl + 'vrv-monitor-platform-web/tibetInstagram/queryInstagram', //查询instragram分页列表
    instragramTime: t.baseUrl + 'vrv-monitor-platform-web/tibetInstagram/queryInstagram', //根据时间查询instragram列表
    shouYe: t.baseUrl + 'vrv-monitor-platform-web/tibetHomePageModule/queryHomePageData', //首页模块接口
    yzmimg: t.baseUrl + 'vrv-monitor-platform-web/captcha.jpg', //验证码图片
    getSkypeG: t.baseUrl + 'vrv-monitor-platform-web/tibetNewAppSkypeList/getSkypeG', //这个是skype的根据群id查群里面信息
    getSkypeGList: t.baseUrl + 'vrv-monitor-platform-web/tibetNewAppSkypeList/getSkypeConversationId', //这个是点app查Skype群的列表
    addAPPsearch: t.baseUrl + 'vrv-monitor-platform-web/tibet/queryAppByUserKey', //新增四个app搜索接口
    skypeten: t.baseUrl + 'vrv-monitor-platform-web/tibetNewAppSkypeList/getSkype', //这个是skype的上下10条
    getWhatappList: t.baseUrl + 'vrv-monitor-platform-web/tibetNewAppWhatsappList/getWhatsConversationId', //这个是点app查Whatapp群的列表
    getWhatsappG: t.baseUrl + 'vrv-monitor-platform-web/tibetNewAppWhatsappList/getWhatsappG', //这个是Whatsapp的根据群id查群里面信息
    whatsappten: t.baseUrl + 'vrv-monitor-platform-web/tibetNewAppWhatsappList/getWhatsapp', //这个是Whatsapp的上下10条
    getViberConversationId: t.baseUrl + 'vrv-monitor-platform-web/tibetNewAppViberList/getViberConversationId', //这个是点app查getViber群的列表
    getViberG: t.baseUrl + 'vrv-monitor-platform-web/tibetNewAppViberList/getViberG', //这个是getViber的根据群id查群里面信息
    getViber: t.baseUrl + 'vrv-monitor-platform-web/tibetNewAppViberList/getViber', //这个是getViber的上下10条
    getLineConversationId: t.baseUrl + 'vrv-monitor-platform-web/tibetNewAppLineList/getLineConversationId', //这个是点app查Line群的列表
    getLineG: t.baseUrl + 'vrv-monitor-platform-web/tibetNewAppLineList/getLineG', //这个是Line的根据群id查群里面信息
    getLine: t.baseUrl + 'vrv-monitor-platform-web/tibetNewAppLineList/getLine', //这个是Line的上下10条
    getSame: t.baseUrl + 'vrv-monitor-platform-web/tibet/queryByIdAndTitleContentPrint', // 获取相似文章

    selectWord: t.baseUrl + 'vrv-monitor-platform-web/modifyWord/selectWord',
    weiXinQun: t.weChatUrl + 'WeChatCollect/group/searchGroupAndMemberList',
    weixinQunDetail: t.baseUrl + 'vrv-monitor-platform-web/whcateGroup/queryWhcateGroupByKey',
    getNearByFrindList: t.baseUrl + 'WeChatCollect/lhasa/findNearByFrindList', //朋友圈重点人列表接口
    getFriendcircleDetails: t.baseUrl + 'vrv-monitor-platform-web/tibet/queryWeChatFriendcircleByKeyWords', //朋友圈重点人动态详情
    attention: t.weChatUrl + 'WeChatCollect/group/addIsCollect', // 关注
    yiguanzhu: t.weChatUrl + 'WeChatCollect/group/selectGroupIsCollectIsOne', // 查询已关注群接口
    cancelAdd: t.weChatUrl + 'WeChatCollect/group/updateZero', // 取消关注
    friendAddAttention: t.baseUrl + 'WeChatCollect/lhasa/addRoundIsCollect', //朋友圈里重点人关注
    friendCancelAttention: t.baseUrl + 'WeChatCollect/lhasa/updateRoundZero', //朋友圈里重点人取消关注
    getMainList: t.baseUrl + 'WeChatCollect/lhasa/findNearByFrindIcollectList', //重点人列表
    deletecaji: t.weChatUrl + 'WeChatCollect/position/deletePosition', //删除采集点
    updatecaiji: t.weChatUrl + 'WeChatCollect/position/modifyPosition', //修改采集点
    wangZhanNum: t.baseUrl + 'vrv-monitor-platform-web/tibet/queryPublicGroupFriendTotal', // 获取网站数量
    publickListAll: t.baseUrl + 'vrv-monitor-platform-web/offcialAccount/queryPublicNameTotalList', //公众号列表带数字的

    dataCircle: t.baseUrl + 'vrv-monitor-platform-web/tibet/queryChurchyardHistoryTotal',
    friendDate: t.baseUrl + 'vrv-monitor-platform-web/tibet/queryWechatHistoryTotal',
    closeGuide: t.baseUrl + 'vrv-monitor-platform-web/user/read/updateUserGuide', //关闭功能介绍

    shujutongji: t.baseUrl + 'vrv-monitor-platform-web/tibet/queryDataStatistics'
  };
  t.simpleenumber = 1;
  t.imgurl = 'http://218.94.137.246:35996/'
  t.addevenlistenerAjax = true;
  t.queryAll = document.querySelectorAll.bind(document)
  t.query = document.querySelector.bind(document)
  t.ajax = (obj, callback, fail) => {
    sessionStorage.setItem('loading', 'block')
    callback && typeof callback == 'function' ?
      $.ajax({
        url: obj.url, //可以不是本地域名
        type: obj.type,
        dataType: obj.json || 'json', //jsonp格式访问
        jsonpCallback: 'jsonpCallback', //获取数据的函数
        contentType: obj.contentType || 'application/json;charset=utf-8',
        data: obj.dataJsonp || JSON.stringify(obj.data) || '',
        success: function (data) {
          if (data.message == '没有登录') {
            if (t.addevenlistenerAjax) {
              t.addevenlistenerAjax = false
              message.error('没有登录', [1], )
              window.location.hash = '/login'
              return
            }
            return
          }
          if (data && (!data.statusCode || data.statusCode == 200)) {
            callback(data)
          } else {
            if (obj.yzm) { //验证码
              callback(data)
            }
          }
          setTimeout(() => {
            sessionStorage.setItem('loading', 'none')
          }, 1000)
        },
        error: function (xml, parsererror) {
          fail && typeof fail == 'function' ? fail() : ''
          console.log('失败')
          setTimeout(() => {
            sessionStorage.setItem('loading', 'none')
          }, 1000)
        }
      }, ) : console.log('请输入正确的回调类型')
  };
  //所有接口调用
  //登录
  t.login = (data, callback) => {
    t.ajax({
      url: t.url.login,
      type: 'post',
      data: data,
      yzm: 'yzm'
    }, callback)
  };
  //登录人信息
  t.userInfo = (callback, fail) => {
    t.ajax({
      url: t.url.userInfo,
      type: 'get',
    }, callback, fail)
  };
  // 登出
  t.logout = (callback) => {
    t.ajax({
      url: t.url.logout,
      type: 'post',
    }, callback)
  };
  // 获取相似文章
  t.getSame = (data, callback) => {
    t.ajax({
      url: t.url.getSame,
      type: 'post',
      data: data
    }, callback)
  }
  //这个是点app查群的列表
  t.getSkypeGList = (callback) => {
    t.ajax({
      url: t.url.getSkypeGList,
      type: 'post'
    }, callback)
  }
  //这个是skype的根据群id查群里面信息
  t.getSkypeG = (data, callback) => {
    t.ajax({
      url: t.url.getSkypeG,
      type: 'post',
      data: data
    }, callback)
  }
  //这个是skype的上下10条
  t.skypeten = (data, callback) => {
    t.ajax({
      url: t.url.skypeten,
      type: 'post',
      data: data
    }, callback)
  }
  //这个是点app查whatsapp群的列表
  t.getWhatappList = (callback) => {
    t.ajax({
      url: t.url.getWhatappList,
      type: 'post'
    }, callback)
  }
  //这个是whatsapp的根据群id查群里面信息
  t.getWhatsappG = (data, callback) => {
    t.ajax({
      url: t.url.getWhatsappG,
      type: 'post',
      data: data
    }, callback)
  }
  //这个是whatsapp的上下10条
  t.whatsappten = (data, callback) => {
    t.ajax({
      url: t.url.whatsappten,
      type: 'post',
      data: data
    }, callback)
  }
  //这个是点app查Viber群的列表
  t.getViberConversationId = (callback) => {
    t.ajax({
      url: t.url.getViberConversationId,
      type: 'post'
    }, callback)
  }
  //这个是Viber的根据群id查群里面信息
  t.getViberG = (data, callback) => {
    t.ajax({
      url: t.url.getViberG,
      type: 'post',
      data: data
    }, callback)
  }
  //这个是Viber的上下10条
  t.getViber = (data, callback) => {
    t.ajax({
      url: t.url.getViber,
      type: 'post',
      data: data
    }, callback)
  }
  //这个是点app查Line群的列表
  t.getLineConversationId = (callback) => {
    t.ajax({
      url: t.url.getLineConversationId,
      type: 'post'
    }, callback)
  }
  //这个是Line的根据群id查群里面信息
  t.getLineG = (data, callback) => {
    t.ajax({
      url: t.url.getLineG,
      type: 'post',
      data: data
    }, callback)
  }
  //这个是Line的上下10条
  t.getLine = (data, callback) => {
    t.ajax({
      url: t.url.getLine,
      type: 'post',
      data: data
    }, callback)
  }
  //新增四个app搜索接口
  t.addAPPsearch = (data, callback) => {
    t.ajax({
      url: t.url.addAPPsearch,
      type: 'post',
      data: data
    }, callback)
  }
  // 首页模块接口
  t.shouYe = (data, callback) => {
    t.ajax({
      url: t.url.shouYe,
      type: 'post',
      data: data
    }, callback)
  };
  // 查询舆情列表
  t.queryList = (data, callback, fail) => {
    data.sortField = "addTime";
    t.ajax({
      url: t.url.queryList,
      type: 'post',
      data: data
    }, callback, fail)
  };
  t.userList = (callback) => {
    t.ajax({
      url: t.url.userList,
      type: 'post',
      data: {}
    }, callback)
  };
  t.userData = (data, callback) => {
    t.ajax({
      url: t.url.userData,
      type: 'post',
      data: data
    }, callback)
  };
  //研判列表
  t.queryListyangpang = (data, callback, fail) => {
    t.ajax({
      url: t.url.queryListyangpang,
      type: 'post',
      data: data
    }, callback, fail)
  };
  //删除
  t.del = (data, callback) => {
    t.ajax({
      url: t.url.del,
      type: 'post',
      data: data
    }, callback)
  }
  //研判
  t.yangpang = (data, callback) => {
    t.ajax({
      url: t.url.yangpang,
      type: 'post',
      data: data
    }, callback)
  }
  //详情
  t.detail = (data, callback) => {
    t.ajax({
      url: t.url.detail,
      type: 'post',
      data: data
    }, callback)
  }
  //加入样本库
  t.addSamplelibrary = (data, callback) => {
    t.ajax({
      url: t.url.addSamplelibrary,
      data: data,
      type: 'post'
    }, callback)
  }
  //删除样本库
  t.deleteYb = (data, callback) => {
    t.ajax({
      url: t.url.deleteYb,
      data: data,
      type: 'post'
    }, callback)
  }
  //创建主页模块
  t.create = (data, callback) => {
    t.ajax({
      url: t.url.create,
      type: 'put',
      data: data
    }, callback)
  }
  //查询关键字
  t.keyWord = (data, callback) => {
    t.ajax({
      url: t.url.keyWord,
      type: 'post',
      data: data
    }, callback)
  }
  t.read = (callback) => {
    t.ajax({
      url: t.url.read,
      type: 'get'
    }, callback)
  }
  //删除
  t.delete = (data, callback) => {
    t.ajax({
      url: t.url.delete,
      type: 'delete',
      data: data
    }, callback)
  }
  //更新
  t.update = (data, callback) => {
    t.ajax({
      url: t.url.update,
      type: 'post',
      data: data
    }, callback)
  }
  //地图
  t.diTu = (data, callback) => {
    t.ajax({
      url: t.url.diTu,
      type: 'post',
      data: data
    }, callback)
  }
  //采集限制次数
  t.getNum = (callback) => {
    t.ajax({
      url: t.url.getNum,
      type: 'post'
    }, callback)
  }
  // 历史记录
  t.findPosition = (data, callback) => {
    t.ajax({
      url: t.url.findPosition,
      type: 'post',
      data: data
      // contentType: 'application/x-www-form-urlencoded', url: t.url.findPosition, json: 'jsonp', type: "post"
    }, callback)
  }
  // 查找朋友圈
  t.morePostion = (data, callback) => {
    t.ajax({
      contentType: 'application/x-www-form-urlencoded',
      url: t.url.morePostion,
      json: 'jsonp',
      type: "post",
      dataJsonp: data
    }, callback)
  }

  //查询样本库
  t.selectYb = (data, callback) => {
    t.ajax({
      url: t.url.selectYb,
      data: data,
      type: 'post'
    }, callback)
  }
  //插入用户关键词组
  t.insertKey = (data, callback) => {
    t.ajax({
      url: t.url.insertKey,
      type: 'post',
      data: data
    }, callback)
  }
  //预警查询
  t.simplee = (data, callback) => {
    if (t.simpleenumber == 1) {
      t.simpleenumber++
      t.ajax({
        url: t.url.simplee,
        type: 'post',
        data: data
      }, callback)
    } else {
      setTimeout(() => {
        t.ajax({
          url: t.url.simplee,
          type: 'post',
          data: data
        }, callback)
      }, 500)
    }

  }
  //查询预警信息
  t.simple = (callback) => {
    t.ajax({
      url: t.url.simple,
      type: 'get',
    }, callback)
  }
  //新增修改预警信息
  t.addSimple = (data, callback) => {
    t.ajax({
      url: t.url.addSimple,
      type: 'post',
      data: data
    }, callback)
  }
  //查询用户关键词组
  t.queryKey = (data, callback) => {
    t.ajax({
      url: t.url.queryKey,
      type: 'post',
      data: data
    }, callback)
  }
  //删除用户关键词组
  t.delKeygroup = (data, callback) => {
    t.ajax({
      url: t.url.delKeygroup,
      type: 'post',
      data: data
    }, callback)
  }
  //修改用户关键词组
  t.editKey = (data, callback) => {
    t.ajax({
      url: t.url.editKey,
      type: 'post',
      data: data
    }, callback)
  }
  //查询采集范围
  t.getCollection = (callback) => {
    t.ajax({
      url: t.url.getCollection,
      type: 'get',
    }, callback)
  }
  //添加采集范围
  t.addCollection = (data, callback) => {
    t.ajax({
      url: t.url.addCollection,
      type: 'put',
      data: data
    }, callback)
  }
  //删除采集范围
  t.delCollection = (data, callback) => {
    t.ajax({
      url: t.url.delCollection,
      type: 'delete',
      data: data
    }, callback)
  }
  //修改采集范围
  t.editCollection = (data, callback) => {
    t.ajax({
      url: t.url.editCollection,
      type: 'post',
      data: data
    }, callback)
  }
  //删除采集点
  t.deletecaji = (data, callback) => {
    t.ajax({
      url: t.url.deletecaji,
      type: 'post',
      data: data
    }, callback)
  }
  //修改采集点
  t.updatecaiji = (data, callback) => {
    t.ajax({
      url: t.url.updatecaiji,
      type: 'post',
      data: data
    }, callback)
  }

  //添加黑名单
  t.addBlack = (data, callback) => {
    t.ajax({
      url: t.url.addBlack,
      type: 'put',
      data: data
    }, callback)
  }
  //删除黑名单
  t.delBlack = (data, callback) => {
    t.ajax({
      url: t.url.delBlack,
      type: 'delete',
      data: data
    }, callback)
  }
  //修改黑名单
  t.editBlack = (data, callback, fail) => {
    t.ajax({
      url: t.url.editBlack,
      type: 'post',
      data: data
    }, callback, fail)
  }
  //查询黑名单
  t.getBlack = (callback) => {
    t.ajax({
      url: t.url.getBlack,
      type: 'get',
    }, callback)
  }
  // 获取专题列表
  t.topicList = (callback) => {
    t.ajax({
      url: t.url.tibetModule,
      type: 'get',
    }, callback)
  };
  // 添加专题
  t.addTopic = (data, callback) => {
    t.ajax({
      url: t.url.tibetModule,
      type: 'put',
      data: data
    }, callback)
  };
  // 删除专题
  t.deleteTopic = (data, callback) => {
    t.ajax({
      url: t.url.tibetModule,
      type: 'delete',
      data: data
    }, callback)
  };
  // 修改专题
  t.modifyTopic = (data, callback) => {
    t.ajax({
      url: t.url.tibetModule,
      type: 'post',
      data: data
    }, callback)
  };
  //朋友圈
  t.friendquan = (data, callback) => {
    t.ajax({
      contentType: 'application/x-www-form-urlencoded',
      url: t.url.friendquan,
      json: 'jsonp',
      type: "get",
      dataJsonp: data
    }, callback)
  }
  //微信群
  t.wxList = (callback) => {
    t.ajax({
      contentType: 'application/x-www-form-urlencoded',
      url: t.url.wxList,
      json: 'jsonp',
      type: "post",
    }, callback)
  }
  //微信群成员
  t.wxListPeople = (data, callback) => {
    t.ajax({
      contentType: 'application/x-www-form-urlencoded',
      url: t.url.wxListPeople,
      json: 'jsonp',
      type: "get",
      dataJsonp: data
    }, callback)
  }
  //微信群内容
  t.wxListContent = (data, callback) => {
    t.ajax({
      contentType: 'application/x-www-form-urlencoded',
      url: t.url.wxListContent,
      json: 'jsonp',
      type: "get",
      dataJsonp: data
    }, callback)
  }
  //公众号列表
  t.publickList = (callback) => {
    t.ajax({
      url: t.url.publickList,
      type: 'get'
    }, callback)
  }
  //公众号列表带数字
  t.publickListAll = (data, callback) => {
    t.ajax({
      url: t.url.publickListAll,
      type: 'post',
      data: data
    }, callback)
  }
  t.dataCircle = (data, callback) => {
    t.ajax({
      url: t.url.dataCircle,
      type: 'post',
      data: data
    }, callback)
  }
  t.friendDate = (data, callback) => {
    t.ajax({
      url: t.url.friendDate,
      type: 'post',
      data: data
    }, callback)
  }
  t.shujutongji = (data, callback) => {
    t.ajax({
      url: t.url.shujutongji,
      type: 'post',
      data: data
    }, callback)
  }
  //数据统计
  t.dataStatistics = (data, callback, fail) => {
    t.ajax({
      url: t.url.dataStatistics,
      type: 'post',
      data: data,
    }, callback, fail)
  }
  //添加和取消群收藏
  t.collection = (data, callback) => {
    t.ajax({
      contentType: 'application/x-www-form-urlencoded',
      url: t.url.collection,
      type: "post",
      dataJsonp: data,
      json: 'jsonp',
    }, callback)
  }
  //查看已收藏的群列表
  t.alreadyCollected = (callback) => {
    t.ajax({
      contentType: 'application/x-www-form-urlencoded',
      url: t.url.alreadyCollected,
      json: 'jsonp',
      type: "post"
    }, callback)
  }
  //添加和取消个人朋友圈账号收藏
  t.friendCollection = (data, callback) => {
    t.ajax({
      contentType: 'application/x-www-form-urlencoded',
      url: t.url.friendCollection,
      json: 'jsonp',
      type: "post",
      dataJsonp: data
    }, callback)
  }
  //查看已收藏的个人朋友圈账号列表
  t.alreadyFriendCollection = (callback) => {
    t.ajax({
      contentType: 'application/x-www-form-urlencoded',
      url: t.url.alreadyFriendCollection,
      json: 'jsonp',
      type: "post"
    }, callback)
  }
  //查看所有的个人朋友圈账号列表
  t.allCollection = (callback) => {
    t.ajax({
      contentType: 'application/x-www-form-urlencoded',
      url: t.url.allCollection,
      json: 'jsonp',
      type: "post"
    }, callback)
  }
  //根据微信号查看个人朋友圈列表
  t.wxCollection = (data, callback) => {
    t.ajax({
      contentType: 'application/x-www-form-urlencoded',
      url: t.url.wxCollection,
      json: 'jsonp',
      type: "post",
      dataJsonp: data
    }, callback)
  }
  t.selectWord = (callback) => {
    t.ajax({
      url: t.url.selectWord,
      type: "post",
    }, callback)
  }
  //查询instragram列表
  t.instragram = (data, callback) => {
    t.ajax({
      url: t.url.instragram,
      type: 'post',
      data: data
    }, callback)
  }
  t.wangZhanNum = (data, callback) => {
    t.ajax({
      url: t.url.wangZhanNum,
      type: 'post',
      data: data
    }, callback)
  }
  // 微信群查询
  t.weiXinQun = (data, callback) => {
    t.ajax({
      url: t.url.weiXinQun,
      type: 'post',
      data: data
    }, callback)
  }
  // 微信群详细
  t.weixinQunDetail = (data, callback) => {
    t.ajax({
      url: t.url.weixinQunDetail,
      type: 'post',
      data: data
    }, callback)
  }
  //查询instragram列表分页
  t.instragramPage = (data, callback) => {
    t.ajax({
      url: t.url.instragramPage,
      type: 'post',
      data: data
    }, callback)
  }
  // 获取验证码图片
  t.yzmimg = (callback) => {
    t.ajax({
      url: t.url.yzmimg,
      type: 'get',
    }, callback)
  }
  //查询时间
  t.instragramTime = (data, callback) => {
    t.ajax({
      url: t.url.instragramTime,
      type: 'post',
      data: data
    }, callback)
  }
  // 朋友圈重点人列表接口
  t.getNearByFrindList = (data, callback) => {
    t.ajax({
      url: t.url.getNearByFrindList,
      type: 'post',
      data: data
    }, callback)
  }
  // 朋友圈重点人动态详情
  t.getFriendcircleDetails = (data, callback) => {
    t.ajax({
      url: t.url.getFriendcircleDetails,
      type: 'post',
      data: data
    }, callback)
  }
  // 关注
  t.attention = (data, callback) => {
    t.ajax({
      url: t.url.attention,
      type: 'post',
      data: data
    }, callback)
  }
  // 查询已关注群接口
  t.yiguanzhu = (data, callback) => {
    t.ajax({
      url: t.url.yiguanzhu,
      type: 'post',
      data: data
    }, callback)
  }
  t.cancelAdd = (data, callback) => {
    t.ajax({
      url: t.url.cancelAdd,
      type: 'post',
      data: data
    }, callback)
  }
  //朋友圈里重点人关注
  t.friendAddAttention = (data, callback) => {
    t.ajax({
      url: t.url.friendAddAttention,
      type: 'post',
      data: data
    }, callback)
  }
  //朋友圈重点人取消关注
  t.friendCancelAttention = (data, callback) => {
    t.ajax({
      url: t.url.friendCancelAttention,
      type: 'post',
      data: data
    }, callback)
  }
  //重点人列表接口
  t.getMainList = (data, callback) => {
    t.ajax({
      url: t.url.getMainList,
      type: 'post',
      data: data
    }, callback)
  }
  //关闭功能介绍
  t.closeGuide = (data, callback) => {
    t.ajax({
      url: t.url.closeGuide,
      type: "post",
      data: data
    }, callback)
  }
  //存储
  t.setStore = (key, obj) => {
    localStorage.setItem(key, JSON.stringify(obj))
  };
  t.getStore = (key) => {
    return JSON.parse(localStorage.getItem(key))
  };
  //是否是一个数组
  t.isArray = (obj) => {
    return Object.prototype.toString.call(obj) === '[object Array]';
  }
  //获取地址栏参数
  $.getUrlParam = function (name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
  };
  t.add0 = (m) => {
    return m < 10 ? '0' + m : m
  }
  //unit 时间转换
  t.unixTime = (shijianchuo, flag) => {
    //shijianchuo是整数，否则要parseInt转换
    var time = shijianchuo ? new Date(shijianchuo) : new Date();
    var y = time.getFullYear();
    var m = time.getMonth() + 1;
    var d = time.getDate();
    var h = time.getHours();
    var mm = time.getMinutes();
    var s = time.getSeconds();
    return !flag ? y + '-' + t.add0(m) + '-' + t.add0(d) + ' ' + t.add0(h) + ':' + t.add0(mm) + ':' + t.add0(s) : y + '年' + t.add0(m) + '月' + t.add0(d) + '日';
  }
  //获取时间
  t.getDate = (day, flag) => {
    var time = new Date();
    var y = time.getFullYear();
    var m = time.getMonth() + 1;
    var d = time.getDate();
    var dayTime = new Date(y, m - 1, 0);
    if (day && d < day) {
      d = dayTime + d - day;
      m = m - 1
    } else {
      day ? d = d - day : ''
    }
    return !flag ? y + '-' + t.add0(m) + '-' + t.add0(d) + ' 00:00:00' : y + '-' + t.add0(m) + '-' + t.add0(d) + ' 23:59:59'
  }
  t.substrTime = (time, start) => {
    return start && start == "start" ? time.split(' ')[0] + ' 00:00:00' : time.split(' ')[0] + ' 23:59:59'
  }
  t.tirm = (str) => {
    return str.replace(/^\s+|\s+$/g, '')
  }
  t.yujing = {
    flag: true
  }

  t.definePropertydg = (data, key, val,callback) => {
    t.objserve(val)
    Object.defineProperty(data, key, {
      enumerable: true, //当且仅当该属性的 configurable 为 true 时，该属性描述符才能够被改变，同时该属性也能从对应的对象上被删除。
      configurable: true,
      get: function () {
        return val
      },
      set: function (newVal) {
        if (val == newVal) {
          return
        }
        val = newVal
        typeof callback == 'function' ? callback() : ""
      }
    })
  }

  t.objserve = (data, callback) => {
    if (!data || typeof data !== 'object') {
      return
    }
    Object.keys(data).forEach((key) => {
      t.definePropertydg(data, key, data[key],callback)
    })
  }

  t.stylejson  = [{
    "featureType": "background",
    "elementType": "geometry",
    "stylers": {
        "visibility": "on",
        "color": "#f5f5f5ff"
    }
}, {
    "featureType": "land",
    "elementType": "geometry",
    "stylers": {
        "color": "#f0f0f0ff"
    }
}, {
    "featureType": "water",
    "elementType": "geometry",
    "stylers": {
        "color": "#d2ebffff"
    }
}, {
    "featureType": "green",
    "elementType": "geometry",
    "stylers": {
        "color": "#ebebebff"
    }
}, {
    "featureType": "building",
    "elementType": "geometry.fill",
    "stylers": {
        "color": "#ebebebff"
    }
}, {
    "featureType": "manmade",
    "elementType": "geometry",
    "stylers": {
        "color": "#e6e6e6ff"
    }
}, {
    "featureType": "manmade",
    "elementType": "labels",
    "stylers": {
        "visibility": "on"
    }
}, {
    "featureType": "subwaystation",
    "elementType": "geometry",
    "stylers": {
        "color": "#ffffffff",
        "visibility": "off"
    }
}, {
    "featureType": "education",
    "elementType": "geometry",
    "stylers": {
        "color": "#e6e6e6ff"
    }
}, {
    "featureType": "education",
    "elementType": "labels",
    "stylers": {
        "visibility": "off"
    }
}, {
    "featureType": "education",
    "elementType": "labels.text.fill",
    "stylers": {
        "color": "#d0021bff"
    }
}, {
    "featureType": "medical",
    "elementType": "labels",
    "stylers": {
        "visibility": "off"
    }
}, {
    "featureType": "medical",
    "elementType": "geometry",
    "stylers": {
        "color": "#e6e6e6ff"
    }
}, {
    "featureType": "scenicspots",
    "elementType": "geometry",
    "stylers": {
        "color": "#e9f1e1ff"
    }
}, {
    "featureType": "scenicspots",
    "elementType": "labels",
    "stylers": {
        "visibility": "off"
    }
}, {
    "featureType": "road",
    "elementType": "geometry.fill",
    "stylers": {
        "color": "#ffffffff"
    }
}, {
    "featureType": "road",
    "elementType": "geometry.stroke",
    "stylers": {
        "color": "#e1e1e1ff"
    }
}, {
    "featureType": "road",
    "elementType": "labels",
    "stylers": {
        "visibility": "on"
    }
}, {
    "featureType": "poilabel",
    "elementType": "labels.text.fill",
    "stylers": {
        "color": "#6a778eff"
    }
}, {
    "featureType": "poilabel",
    "elementType": "labels.icon",
    "stylers": {
        "visibility": "off"
    }
}, {
    "featureType": "companylabel",
    "elementType": "labels",
    "stylers": {
        "visibility": "off"
    }
}, {
    "featureType": "companylabel",
    "elementType": "labels.icon",
    "stylers": {
        "visibility": "off"
    }
}]
  window.u = t

})();


export default window.u